package com.t.screenofftouch;

import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;

public class SplashActivity extends Activity{
	private ComponentName mDeviceAdminSample;
	protected static final int REQUEST_CODE_ENABLE_ADMIN = 1;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if(!CommonFunctions.isActiveAdmin(getApplicationContext())){
			
			mDeviceAdminSample = new ComponentName(this,DeviceAdminSampleReceiver.class);
			Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
			intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,mDeviceAdminSample);
			intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
					"Additional text explaining why this needs to be added.");
			startActivityForResult(intent, REQUEST_CODE_ENABLE_ADMIN);
			finish();
		}
	}

}
